#include <iostream>
#include "common/logger.h"
#include "singleshot.h"
#include "factory.h"
#include <memory.h>
#include "test.h"

#include "observe.h"

using namespace singleshot;
void usage()
{
    common::Logger::output("Usage");
}

int main()
{
    usage();

    //singleshot
    CSingleShot<TestB>::getInstance()->print();

    //simple factory
    auto f_a = std::shared_ptr<factory::CBaseProduct>(factory::CSimpleFactory::GetProuct(factory::ProductA));
    common::Logger::output(f_a->GetDetail());
    auto f_b = std::shared_ptr<factory::CBaseProduct>(factory::CSimpleFactory::GetProuct(factory::ProductB));
    common::Logger::output(f_b->GetDetail());

    //factory 
    auto f_ = std::shared_ptr<factory::CBaseProduct>(factory::CFactoryA().gen_product());
    common::Logger::output(f_->GetDetail());
    //test

    observe::CObserved observed;
    auto obB = new observe::CObserveB();
    observed.add_observe(new observe::CObserveA());
    observed.add_observe(obB);
    observed.update();
    cout<<"================="<<endl;
    observed.remove_observe(obB);
    observed.update();
    return 1;
}
